// 数量汇总表
<template>
  <div class="container">
    <cargo-sum-content
      :operaList="operaList"
      :tableList="tableList"
      :tableData="tableData"
      :res="res"
      :kind="kind"
      :total_count="total_count"
      @getData="getData"
      @deleteData="deleteData"
      @addData="addData"
      @editData="editData"
    >
      <!-- <template slot="navBar">
        <el-select @change="selectChange(value)" v-model="value" filterable placeholder="请选择">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </template> -->
    </cargo-sum-content>
  </div>
</template>

<script>
// import { GetQuality } from '@/api/graphiting.js'
import {GetSum} from '@/api/cargo.js'
import { Delete } from '@/api/reusable.js'
import '@/mock/default.js'
import { tableMix } from '@/mixin/tableMix.js'
import { inputOperaList as operaList } from '@/assets/staticData/operaList/cargo.js'
import { SummaryTableList as tableList } from '@/assets/staticData/tableList/cargo.js' // 汇总表标题
export default {
  name: '',
  components: {},
  props: {},
  mixins: [tableMix], // 一些公用的属性方法可以放在mixin里面,各个组件互不影响
  data () {
    return {
      value: 'Ø600'
    }
  },
  computed: {},
  watch: {},
  beforeCreate () {},
  created () {
    this.kind = this.kind
    this.getData({
      time_stamp1: new Date().getTime() - 3600 * 1000 * 24 * 3,
      time_stamp2: new Date().getTime()
    })
  },
  mounted () {
    // this.getData()
  },
  methods: {
    addData (data) {
      this.$axios.get('http://127.0.0.1:7002/addRes')
        .then(res => {
          this.res = res.data
        })
    },
    editData (_id, data) {
      this.$axios.get('http://127.0.0.1:7002/editRes')
        .then(res => {
          // console.log(res)
          this.res = res.data
        })
    },
    getData (data) {
      console.log(data)
      this.operaList = operaList
      this.tableList = tableList
      GetSum(data).then(res => {
        console.log(res)
        this.tableData = res.data.data
      })
    },
    deleteData (data) {
      // console.log('我是父组件，我来接收数据', data)
      // this.$axios.get('http://127.0.0.1:7002/delRes')
      Delete({
        _id: data._id,
        collection: this.kind
      })
        .then(res => {
          // console.log(res)
          this.res = res
          this.getData({
            page: 1,
            per_page: 10
          })
        })
    },
    selectChange (i) {
      // console.log(i)
    }
  }
}
</script>

<style scoped lang="">
</style>
